package com.example.helper;

import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;

/**
 * @author ChenXiaoBin
 * on 2019-12-17
 */
public class WechatHelper {

    public WxMpService instanceWxMpService () {
        //相当与注册
        WxMpService mpService = new WxMpServiceHttpClientImpl();
        WxMpDefaultConfigImpl wxMpConfigStorage = new WxMpDefaultConfigImpl();
        wxMpConfigStorage.setAppId("wx65253d4d6da76947");
        wxMpConfigStorage.setToken("cxbcxb");
        wxMpConfigStorage.setAesKey("12");
        wxMpConfigStorage.setSecret("eaac587494f79f0692a597ef6452693c");
        mpService.setWxMpConfigStorage(wxMpConfigStorage);
        mpService.addConfigStorage(wxMpConfigStorage.getAppId(), wxMpConfigStorage);
        return mpService;
    }
}
